import React from 'react';
// import styles from '../index.module.scss';

interface IProps {
	label: string;
	key: number;
	id: string;
	activeNodeId: string;
	handleClick: ( id: string ) => void;
}

const TreeNode = ( props: IProps ) => {
	let isActive = props.activeNodeId === props.id;

	return (
		<div
			className={ `tree_node ${ isActive ? 'tree_node_active' : '' }` }
			onClick={ () => {
				props.handleClick( props.id );
			} }>

			<span className={ `iconfont ${ isActive ? 'bdhwenjianjiadakai' : 'bdhwenjianjiaguanbi' }` }></span>

			{ props.label }
		</div>
	);
};

export default TreeNode;
